<h2 mat-dialog-title>重命名</h2>
<mat-dialog-content> 
    <mat-form-field class="example-full-width">
      <mat-label>名称</mat-label>
      <input type="text" matInput [formControl]="nameFormControl" placeholder="请输入新名称">
      @if (!nameFormControl.hasError('required')) {
        <mat-error>请输入新名称</mat-error>
      } 

      @if (nameFormControl.hasError('nameMismatch')) {
        <mat-error>未变更</mat-error>
      }
    </mat-form-field>
</mat-dialog-content>
<mat-dialog-actions>
  <button mat-button (click)="onNoClick()">取消</button>
  <button mat-button (click)="onYesClick()" [disabled]="!nameFormControl.valid" cdkFocusInitial>确定</button>
</mat-dialog-actions>
